package com.wsd.music.service.imp;

import com.wsd.music.entity.SongSheet;
import com.wsd.music.mapper.SongSheetMapper;
import com.wsd.music.service.SongSheetService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SongSheetServiceImp implements SongSheetService {

    @Resource
    SongSheetMapper mapper;

    /**
     * 新增歌单歌曲
     * @param songSheet
     * @return
     */
    @Override
    public boolean insert(SongSheet songSheet) {
        return mapper.insert(songSheet) > 0;
    }

    /**
     * 修改歌单歌曲信息
     * @param songSheet
     * @return
     */
    @Override
    public boolean modify(SongSheet songSheet) {
        return mapper.modify(songSheet) > 0;
    }

    /**
     * 通过ID删除歌单歌曲
     * @param id
     * @return
     */
    @Override
    public boolean delete(int id) {
        return mapper.delete(id) > 0;
    }

    /**
     * 通过主键ID查询歌单歌曲信息
     * @param id
     * @return
     */
    @Override
    public SongSheet selectById(int id) {
        return mapper.selectById(id);
    }

    /**
     * 查询所有歌单中的歌曲
     * @return
     */
    @Override
    public List<SongSheet> selectAll() {
        return mapper.selectAll();
    }

    /**
     * 根据歌单ID查询所有歌曲
     * @param songListId
     * @return
     */
    @Override
    public List<SongSheet> selectSongsBySongListId(int songListId) {
        return mapper.selectSongsBySongListId(songListId);
    }
}
